package com.ylfstu.file;

import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;

public class FileInformation {
    public static void main(String[] args) {

    }

    @Test
    public void info() {
        File file = new File("F:\\YLF\\javastudy\\filestudy\\news1.txt");
        System.out.println(file.getName());
        System.out.println(file.getAbsoluteFile());
        if (file.exists()) {
            file.delete();
            System.out.println("已删除~");
        } else {
            try {
                file.createNewFile();
                System.out.println("创建成功");
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}
